package com.vondear.rxui.view.dialog;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;

import com.vondear.rxtool.view.RxToast;
import com.vondear.rxui.R;
import com.vondear.rxui.view.progressing.SpinKitView;

/**
 * 
 * @date 2017/3/16
 */

public class RxDialogDownload extends RxDialog {

    private View mDialogContentView;
    private TextView mTextView;

    public RxDialogDownload(Context context, int themeResId) {
        super(context, themeResId);
        initView(context);
    }

    public RxDialogDownload(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        initView(context);
    }

    public RxDialogDownload(Context context) {
        super(context);
        initView(context);
    }

    public RxDialogDownload(Activity context) {
        super(context);
        initView(context);
    }

    public RxDialogDownload(Context context, float alpha, int gravity) {
        super(context, alpha, gravity);
        initView(context);
    }

    private void initView(Context context) {
        mDialogContentView = LayoutInflater.from(context).inflate(R.layout.dialog_loading_spinkit, null);
        mTextView = mDialogContentView.findViewById(R.id.name);
//        ImageView img = mDialogContentView.findViewById(R.id.img);
//        Animation rotateAnimation = AnimationUtils.loadAnimation(context, R.anim.rotate_anim);
//        LinearInterpolator lin = new LinearInterpolator();
//        rotateAnimation.setInterpolator(lin);
//        img.startAnimation(rotateAnimation);
        setContentView(mDialogContentView);
    }

    public void setLoadingText(CharSequence charSequence) {
        mTextView.setText(charSequence);
    }

    public TextView getTextView() {
        return mTextView;
    }

}
